﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbLayerStateManagerReactor : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbLayerStateManagerReactor(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbLayerStateManagerReactor_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbLayerStateManagerReactor obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbLayerStateManagerReactor()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbLayerStateManagerReactor(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbLayerStateManagerReactor cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbLayerStateManagerReactor_cast(OdRxObject.getCPtr(pObj));
			OdDbLayerStateManagerReactor result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbLayerStateManagerReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbLayerStateManagerReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbLayerStateManagerReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbLayerStateManagerReactor_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbLayerStateManagerReactor_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbLayerStateManagerReactor_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdDbLayerStateManagerReactor createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbLayerStateManagerReactor_createObject();
			OdDbLayerStateManagerReactor result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbLayerStateManagerReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbLayerStateManagerReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbLayerStateManagerReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void layerStateCreated(string layerStateName, OdDbObjectId layerStateId)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_layerStateCreated(this.swigCPtr, layerStateName, OdDbObjectId.getCPtr(layerStateId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void layerStateCompareFailed(string layerStateName, OdDbObjectId layerStateId)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_layerStateCompareFailed(this.swigCPtr, layerStateName, OdDbObjectId.getCPtr(layerStateId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void layerStateToBeRestored(string layerStateName, OdDbObjectId layerStateId)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_layerStateToBeRestored(this.swigCPtr, layerStateName, OdDbObjectId.getCPtr(layerStateId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void layerStateRestored(string layerStateName, OdDbObjectId layerStateId)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_layerStateRestored(this.swigCPtr, layerStateName, OdDbObjectId.getCPtr(layerStateId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void abortLayerStateRestore(string layerStateName, OdDbObjectId layerStateId)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_abortLayerStateRestore(this.swigCPtr, layerStateName, OdDbObjectId.getCPtr(layerStateId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void layerStateToBeDeleted(string layerStateName, OdDbObjectId layerStateId)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_layerStateToBeDeleted(this.swigCPtr, layerStateName, OdDbObjectId.getCPtr(layerStateId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void layerStateDeleted(string layerStateName)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_layerStateDeleted(this.swigCPtr, layerStateName);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void abortLayerStateDelete(string layerStateName, OdDbObjectId layerStateId)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_abortLayerStateDelete(this.swigCPtr, layerStateName, OdDbObjectId.getCPtr(layerStateId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void layerStateToBeRenamed(string oldLayerStateName, string newLayerStateName)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_layerStateToBeRenamed(this.swigCPtr, oldLayerStateName, newLayerStateName);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void layerStateRenamed(string oldLayerStateName, string newLayerStateName)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_layerStateRenamed(this.swigCPtr, oldLayerStateName, newLayerStateName);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void abortLayerStateRename(string oldLayerStateName, string newLayerStateName)
		{
			TD_DbPINVOKE.OdDbLayerStateManagerReactor_abortLayerStateRename(this.swigCPtr, oldLayerStateName, newLayerStateName);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
